feat(collections): show a dataset's JSON schema in a modal - #364
Open
jirhiker wants to merge 1 commit into
Open
Conversation
Each row in the datasets catalog gets a Schema button that opens the
collection's published JSON Schema
(`/ogcapi/collections/{id}/schema?f=json`) as a readable field table:
name, title, OGC role, type, description, and enum values. A Raw JSON
toggle and a copy button cover the case where the document itself is
what the reader wants.
The field table is the default view because the server fills in
per-property titles and descriptions that a raw JSON dump buries, and
the schema is read far more often to answer "what columns does this
dataset have" than to be copied verbatim.
Two shape details the renderer has to handle: a geometry property
arrives with a `format` and no `type`, so the type label falls back to
format; and controlled vocabularies run to two dozen entries, so enum
chips are capped with the remainder behind a tooltip. Below the tablet
breakpoint the three-column table is replaced by a stacked per-field
layout, which a phone can actually read.
The schema types are hand-written zod, like `gisArtifacts.ts`: the
committed `openapi-auth.json` snapshot describes none of the `/ogcapi`
paths, so `src/generated` cannot describe this response yet.
Also hides the desktop-GIS connections panel, table column, and
per-card download links behind a single `SHOW_DESKTOP_GIS` constant.
The catalog data still loads — the collection index keys off it — so
flipping the constant back to `true` restores all three together.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Preview DeploymentPreview URL: https://preview-feature-dataset-json-schema-modal-auejgdbofq-uc.a.run.app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Schema button to every row of the datasets catalog (both table and card views). It opens the collection's published JSON Schema —
GET /ogcapi/collections/{id}/schema?f=json— as a readable field table: name, title, OGC role, type, description, and enum values. A Raw JSON toggle and a copy button cover the case where the document itself is what the reader wants.Also hides the desktop-GIS surfaces on this page (see below).
Why the field table is the default view
The server fills in per-property
titleanddescriptionfor these collections, and a raw JSON dump buries them. The schema is read far more often to answer "what columns does this dataset have and what do they mean" than to be copied verbatim — so the readable view leads and the raw document is one toggle away.Shape details the renderer has to handle
format(geometry-any) and notype, so the type label falls back to format.Hand-written zod, deliberately
collectionSchema.tshand-writes the schema types, the same waygisArtifacts.tsdoes. The committedopenapi-auth.jsonsnapshot describes none of the/ogcapipaths, sosrc/generatedcannot describe this response. Replace with generated schemas once the OGC surface lands in the deployed spec.Desktop GIS hidden
The connections panel, the table's Desktop GIS column, and the per-card download links are now gated behind a single
SHOW_DESKTOP_GIS = falseconstant inlist.tsx. The catalog data still loads (the collection index keys off it), so flipping the constant back totruerestores all three together. The table's last column is renamed Map → Actions and the group-bandcolSpanfollows the flag.The sidebar's "Connect Desktop GIS" link is a separate page and is untouched.
Verification
npm run typecheckclean.npm run test:run— 434 passed, 1 skipped, including 13 new tests acrosscollectionSchema.test.tsandCollectionSchemaDialog.test.tsx.list.tsx(sortOgcCollectionsunused) is pre-existing onstaging.🤖 Generated with Claude Code